<?php
class admin_View_Helper_PrivilegeByAction extends Zend_View_Helper_Abstract
{
	public function PrivilegeByAction($data=array())
	{
		$viewRenderer =  Zend_Controller_Action_HelperBroker::getStaticHelper('viewRenderer');
		$view = $viewRenderer->view;
		
		$content =$view->translate('Action Num :').$data['action']->id;
		$content .=', '.$view->translate('Module :').$data['action']->module;
		$content .=', '.$view->translate('Action Name :').$data['action']->controller.":".$data['action']->action;
		$content .=', '.$view->translate('Description').$data['action']->description;
		$content .="<table width='100%' border='1'>";
		$content .="<tr><th>".$view->translate('Role')."</th>
						<th>".$view->translate('Privilege')."
						</th>
					</tr>";
		if($data['roles'])
		foreach($data['roles'] as $role) {
			$content .= "<tr><td>".$role->role."</td><td>".$role->privilege."</td></tr>";
		}
		$content .="</table>";
		
		return $content;
	}
}
